import 'living.dart';
import 'bag.dart';
import 'thing.dart';
import 'engine.dart';

class Hero extends Living {
  Bag bag = Bag();
  Hero(Map map) : super(map) {
    name = map['name'];
  }

  getThing(Thing thing) {
    bag.things.add(thing);
    Engine.instance.displayer.displayString('[${name}]获得了[${thing.name}]');
  }
  pureRemoveThing(Thing thing) {
    pureRemoveThingByCode(thing.code);
  }
  pureRemoveThingByCode(String code) {
    bag.things.removeWhere((test){
      bool result = test.code==code;
      if (result) {
        Engine.instance.displayer.displayString('[${test.name}]从[${name}]身上消失了');
      }
      return result;
    });
  }
}